<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use \DB;
use \Hash;
use App\Http\Requests;
use App\Http\Requests\UserAddPostRequest;
use App\Http\Requests\EditPassPostRequest;
use App\Http\Controllers\Controller;

class AdminController extends Controller
{
    //后台首页
    public function getIndex(Request $request){

    	$sessiondata = $request->session()->all();
    	$sessionid=$sessiondata['id'];
    	$sessionusername=$sessiondata['username'];
    	$sessionres=DB::table('adminuser')->where('id',$sessionid)->first();

    	 $a=date('H',time());
    	 switch ($a) {
    	 	case '6':case '7':case '8':
    	 		$atext= "每天都是新的自己，".$sessionusername."早上好!";
    	 		break;
    	 	case '9':case '10':case '11':
				$atext= $sessionusername."上午好，生活是一面镜子，你笑它也笑。";
				break;	
    	 	case '12':case '13':
				$atext= $sessionusername." 中午好，吃饭的时候最好不要盯着电脑哦。";
				break;
    	 	case '14':
				$atext= $sessionusername."有时间听首歌吧，跳跃的音符带来最好的休憩。";
				break;
			case '15':case '16':case '17':case '18':
				$atext= $sessionusername."下午好,午后一杯红茶,偷得片刻惬意。";
				break;
			case '19':case '20':
				$atext= $sessionusername."晚上好,夜幕降落，霓红灯亮起，城市迎来另一种喧闹。";
				break;
    	 	case '21':case '22':
				$atext=$sessionusername."今天累不累？停下来听首歌吧。";
    	 		break;
    	 	default:
    	 		$atext=$sessionusername."寂静的深夜，除了自己的心跳，还有我在陪你。";
    	 		break;
    	 }


    	//显示模板
    	return view('admin.index',['usersessioninfo'=>$sessionres,'atext' => $atext]);
    }
}
